from django.db import models


# Create your models here.
class Question(models.Model):
    # 题目标识
    QTYPE = (('0', '填空题'), ('1', '单选题'), ('2', '判断题'), ('3', '论述题'))
    title = models.CharField(max_length=255, null=False, unique=True)
    # 题目类型
    qtype = models.CharField(max_length=1, choices=QTYPE)
    # 选项1-4
    option1 = models.CharField(max_length=255)
    option2 = models.CharField(max_length=255)
    option3 = models.CharField(max_length=255)
    option4 = models.CharField(max_length=255)

    # 参考答案  填空or选择or判断
    ref_answer = models.CharField(max_length=255)
    #   解析  对于所有题型
    analysis = models.TextField(null=False, default='')
    # 数据创建时间
    create_time = models.DateTimeField(auto_now_add=True)
    #     数据修改时间
    update_time = models.DateTimeField(auto_now=True)

    class Meta:
        verbose_name = '问题'
        verbose_name_plural = '问题'

    def __str__(self):
        return self.title


class Student(models.Model):
    SEX = (('0', '女性'), ('1', '男性'))
    # id = models.AutoField()
    stu_name = models.CharField(max_length=20, verbose_name='学生姓名')
    sex = models.CharField(max_length=1, choices=SEX, verbose_name='性别')
    cls = models.CharField(max_length=20, verbose_name='班级')
    subject = models.CharField(max_length=20, verbose_name='专业')
    img_path = models.CharField(max_length=255, verbose_name='图片存储路径')

    def __str__(self):
        return self.stu_name

    class Meta:
        verbose_name = verbose_name_plural = '学生'
        # verbose_name_plural = '学生'


class Score(models.Model):
    showok = (('0', '没出来'), ('1', '出来了'))
    name = models.CharField(max_length=20)
    blanks = models.CharField(max_length=20)
    quers = models.CharField(max_length=20)
    comput = models.CharField(max_length=20)
    showok = models.CharField(max_length=1)


class Scoreexam(models.Model):
    showok = (('0', '没出来'), ('1', '出来了'))
    name = models.CharField(max_length=20)
    blanks = models.CharField(max_length=20)
    choiceq = models.CharField(max_length=20)
    quers = models.CharField(max_length=20)
    comput = models.CharField(max_length=20)
    showok = models.CharField(max_length=1)


class Teacher(models.Model):
    name = models.CharField(max_length=255)
    age = models.IntegerField()


class Analysis(models.Model):
    count = models.IntegerField()
